<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>inline-block结合伪元素实现居中</title>
        <script>
            !function(t,e){var n=t.documentElement,i="orientationchange"in window?"orientationchange":"resize",o=function(){var t=n.clientWidth,e=750;t&&(t>=e?n.style.fontSize="100px":n.style.fontSize=100*(t/e)+"px")};o(),t.addEventListener&&(e.addEventListener(i,o,!1),t.addEventListener("DOMContentLoaded",o,!1))}(document,window);
        </script>
        <style>
            *{
                margin: 0;
                padding: 0;
            }
            html,body{
                height: 100%;
            }
            .block{
                height: 100%;
                text-align: center;
            }
            .block:before{
                content:'';
                height: 100%;
                width: 0;
                vertical-align: middle;
                display: inline-block;
            }
            .centered{
                display: inline-block;
                vertical-align: middle;
                padding: 10px;
                background-color: #ccc;
                color:#fff;
                line-height: 30px;
                font-size: 16px;
            }
        </style>
    </head>
    <body>
        <div class="block">
            <div class="centered">
                <p>Vue的学习</p>
                <p>好好看书</p>
                <p>提高学习能力</p>
            </div>
        </div>
    </body>
</html>